package info.manxi;

import akka.actor.ActorRef;

import java.util.LinkedList;
import java.util.List;

class 运行时数据 implements 可接受数据 {
  private final ActorRef target;
  private final List<Object> queue;

  public 运行时数据(ActorRef target, List<Object> queue) {
    this.target = target;
    this.queue = queue;
  }

  public ActorRef getTarget() {
    return target;
  }

  public List<Object> getQueue() {
    return queue;
  }

  @Override
  public String toString() {
    return "Todo{" + "target=" + target + ", queue=" + queue + '}';
  }

  public 运行时数据 addElement(Object element) {
    List<Object> nQueue = new LinkedList<>(queue);
    nQueue.add(element);
    return new 运行时数据(this.target, nQueue);
  }

  public 运行时数据 copy(List<Object> queue) {
    return new 运行时数据(this.target, queue);
  }

  public 运行时数据 copy(ActorRef target) {
    return new 运行时数据(target, this.queue);
  }
}